package com.nf.health.app.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.nf.health.app.R;
import com.nf.health.app.utils.DensityUtil;

/**
 * 我的模块第一次所弹出的悬浮框
 * @author yuyahao
 */

public class ShowMyDataMineDialog extends Dialog {
    private LinearLayout ll_contentshowdatal;
    private Context context;
    public ShowMyDataMineDialog(Context context) {
        super(context,  R.style.Dialog_Fullscreen);
        this.context = context;
        setContentView(R.layout.activity_data_all);
        ll_contentshowdatal = (LinearLayout) findViewById(R.id.ll_contentshowdata);
    }
    public ShowMyDataMineDialog(Context context, int themeResId) {
        super(context,  R.style.Dialog_Fullscreen);
        this.context = context;
        setContentView(R.layout.activity_data_all);
        ll_contentshowdatal = (LinearLayout) findViewById(R.id.ll_contentshowdata);
    }
    // 初始化弹出框私人医生
    public ShowMyDataMineDialog showMyPersionDoctor(){
        ImageView imageView = new ImageView(context);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        imageView.setLayoutParams(params);
        imageView.setImageResource(R.drawable.data_dialog_image7);
        ll_contentshowdatal.setPadding(DensityUtil.dip2px(context,5),DensityUtil.dip2px(context,30),0, 0);
        ll_contentshowdatal.setGravity( Gravity.LEFT| Gravity.TOP);
        ll_contentshowdatal.addView(imageView);
        return this;
    }

    /**
     * 抢红包数据
     * @return
     */

    public ShowMyDataMineDialog showMyDataShopStoreShop(){
        ImageView imageView = new ImageView(context);
        ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        imageView.setLayoutParams(params);
        imageView.setImageResource(R.drawable.data_dialog_image8);
        ll_contentshowdatal.setGravity( Gravity.RIGHT| Gravity.TOP);
        ll_contentshowdatal.setPadding(DensityUtil.dip2px(context,0),DensityUtil.dip2px(context,30),DensityUtil.dip2px(context,5),0);
        ll_contentshowdatal.addView(imageView);
        return this;
    }
    public ShowMyDataMineDialog dismissDialog(){
        if(isShowing()){
            dismiss();
        }
        return this;
    }
    public ShowMyDataMineDialog showDialog(){
        if(!isShowing()){
            show();
        }
        return this;
    }

    /**
     * 点击图片进行的回掉事件
     * @param onClickListener
     * @return
     */
    public ShowMyDataMineDialog setMyClickListener(View.OnClickListener onClickListener){
        ll_contentshowdatal.setOnClickListener(onClickListener);
        return this;
    }
}
